<!DOCTYPE html>
<html>

{include file='public/header'}

<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">投放管理</a>
            <a><cite>按公司统计</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">

        <form class="layui-form layui-row" style="margin-top:15px;margin-bottom: 10px;">
            <div class="layui-inline">
                <label class="layui-form-label w-auto">投放媒体：</label>
                <div id="pMenu"></div>
            </div>
            <div class="layui-inline" id="dataTime">
                <label class="layui-form-label w-auto">日期：</label>
                <div class="layui-inline" id="time" style="display: flex;align-items: center;">
                    <div class="layui-input-inline" style="margin-right:10px">
                        <input type="text" class="layui-input" name="start_date" id="start_time" autocomplete="off" placeholder="开始日期">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="end_date" id="end_time" autocomplete="off" placeholder="结束日期">
                    </div>
                </div>
            </div>
            
            <div class="layui-inline" style="margin-left:10px">
                <button class="layui-btn" lay-submit lay-filter="searchList">搜索</button>
                <button type="reset" id="resetList" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </form>
        <table id="byCompanyCountList" lay-filter="byCompanyCountList"></table>
    </div>
    <script>
        let params = {
            elem: '#byCompanyCountList'
            , toolbar: false
            , url: '/admin/launch/byCompanyCountList' //数据接口
            , id: 'byCompanyCountList'
            , page:false
            , cols: [[ //表头
                { field: 'company_id', title: '公司ID', align: 'center', width:86 }
                , { field: 'company_name', title: '公司名称', align: 'center', width:150 }
                , { field: 'register_user_num', title: '注册用户', align: 'center' }
                , { field: 'activation_user_num', title: '激活用户数<i class="layui-icon iconfont icon-lytishi1" id="activation_user_num"></i>', align: 'center', width:130 }
                , { field: 'cost', title: '消耗<i class="layui-icon iconfont icon-lytishi1" id="cost"></i>', align: 'center' }
                , { field: 'actual_cost', title: '实际消耗<i class="layui-icon iconfont icon-lytishi1" id="actual_cost"></i>', align: 'center' }
                , { field: 'conversion_number', title: '充值人数', align: 'center',  }
                , { field: 'recharge_number', title: '充值笔数', align: 'center' }
                , { field: 'current_recharge', title: '充值<i class="layui-icon iconfont icon-lytishi1" id="current_recharge"></i>', align: 'center' }
                , { field: 'total_recharge', title: '累计充值<i class="layui-icon iconfont icon-lytishi1" id="total_recharge_tips"></i>', align: 'center' }
                , { field: 'current_recharge_discount', title: '收益<i class="layui-icon iconfont icon-lytishi1" id="current_recharge_discount"></i>', align: 'center'}
                , { field: 'total_income', title: '累计收益<i class="layui-icon iconfont icon-lytishi1" id="total_income_tips"></i>', align: 'center' }
                , { field: 'current_recharge_profit', title: '利润<i class="layui-icon iconfont icon-lytishi1" id="current_recharge_profit"></i>', align: 'center'}
                , { field: 'current_recovery', title: '返后ROI<i class="layui-icon iconfont icon-lytishi1" id="current_recovery"></i>', align: 'center' }
                
                , { field: 'total_recovery', title: '累计ROI<i class="layui-icon iconfont icon-lytishi1" id="total_recovery"></i>', align: 'center' }
                // , { field: 'revenue', title: '营收', align: 'center' }
            ]],
            done: function(){
                tips('#cost', '#cost', '扣除返点前的消耗')
                tips('#actual_cost', '#actual_cost', '扣除返点后的消耗')
                tips('#activation_user_num', '#activation_user_num', '今日从推广链接进入的用户数')
                tips('#current_recharge', '#current_recharge', '该剧每日当天充值总和')
                tips('#current_recharge_discount', '#current_recharge_discount', '充值*0.9（2023年8月21号前按：充值*0.95）')
                tips('#current_recharge_profit', '#current_recharge_profit', '累计收益-实际消耗')
                tips('#current_recovery', '#current_recovery', '收益除以实际消耗的百分比')
                tips('#total_recharge_tips','#total_recharge_tips','当日激活的用户在当天以及后续的累计充值')
                tips('#total_income_tips','#total_income_tips','累计充值*0.9（2023年8月21号前是当天充值*0.95）')
                tips('#total_recovery','#total_recovery','累计收益除以实际消耗的百分比')
            }
        }
        tableList(params)

        let selectParams = {
            url: '/admin/launch/getLaunchMedia',
            selected: [],
            tips: '选择媒体',
            name: 'media_id',
            field_id: 'id',
            field_Name: 'name',
            elem: '#pMenu',
            disabled:false
        }
        selectN(selectParams)
        // 日期
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#time',
                range: ['#start_time', '#end_time'],
                format: 'yyyy-MM-dd'
            });
        })
    </script>
</body>

</html>